Skip to content

Add page get --as raw and surface lossy rendering via render_notes#7

Merged
AngelMsger merged 1 commit into
mainfrom
feature/page-get-raw-and-render-notes
May 18, 2026
Merged

Add page get --as raw and surface lossy rendering via render_notes#7
AngelMsger merged 1 commit into
mainfrom
feature/page-get-raw-and-render-notes

Conversation

@AngelMsger
Copy link
Copy Markdown
Owner

Why

A Coding Agent wrote a valid view-file macro to a page, but page get
rendered the body to markdown and silently dropped the macro — the agent
had no way to tell content was lost, and no way to retrieve the source.

A read-pipeline audit found two real inconsistencies:

  1. Lossy rendering was silent and asymmetric. The write direction
    (MarkdownToStorage) warns on unsupported constructs; the read direction
    (Render) had no signal at all — unknown macros dropped, images → [image].
  2. No lossless escape hatch. --as markdown|text both transform; the raw
    storage XHTML was unreachable.

Changes

  • render.Render reports Notes — a parse-time tree scan (lossNotes)
    names structured macros without a native rendering and placeholdered images.
    page get surfaces them as a render_notes output field. Rendering loss is
    no longer silent.
  • page get --as raw emits the body source untouched (storage XHTML, or
    view HTML with --body-format view) — no rendering. Requires --scope full
    (slicing unparsed source is out of scope here).

The --body-format (representation to fetch) vs --as (output form) axes are
kept as-is; --as simply gains raw as its lossless value, completing the axis.
Both additions are non-breaking (render_notes is omitempty).

Verification

  • gofmt / go vet / go test ./... green; make e2e 44/44; make docs
    idempotent. New tests: render Notes for dropped macros/images; page get --as raw returns source verbatim; --as raw --scope outline is rejected.
  • Live Data Center check: page get <id> --as raw returns the stored
    <ac:structured-macro ac:name="view-file"> (confirming the macro was
    written correctly); the default render reports it in render_notes.

Patch/minor material — additive only. Suggest v0.4.0.

🤖 Generated with Claude Code

`page get` rendered storage XHTML to markdown/text and silently dropped
whatever it could not represent — macros without a native rendering (e.g.
view-file), images degraded to a placeholder. There was no signal that
content was lost and no way to retrieve the untouched source. The write
direction already warns on lossy conversion (MarkdownToStorage); the read
direction did not — an asymmetry.

- `render.Render` now returns `Notes`: a parse-time tree scan (`lossNotes`)
  reports structured macros it does not natively render and images shown as
  placeholders. `page get` surfaces them as a `render_notes` output field.
- `page get --as raw` emits the body source untouched (storage XHTML, or
  view HTML with --body-format view), skipping rendering entirely. It
  requires --scope full — slicing unparsed source is out of scope.

The `--body-format` (source representation to fetch) vs `--as` (output form)
split is kept; `--as` gains `raw` as the lossless option, completing that axis.

Verified against a live Data Center instance: `page get <id> --as raw` shows
the stored view-file macro; the default render now reports it in render_notes.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@AngelMsger AngelMsger merged commit 90fc1ea into main May 18, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant